﻿<UserControl x:Class="ISRecord.View.Views.AllOutboxesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:p="clr-namespace:ISRecord.View.Properties"
             xmlns:extended="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
             mc:Ignorable="d" d:DesignHeight="700" d:DesignWidth="700" FlowDirection="RightToLeft"
             Style="{StaticResource UserControlStyle}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <ToolBarTray Margin="3">
            <ToolBar>
                <Button Content="{StaticResource FindImage}" Margin="3" Command="{Binding FindCommand}"
                        ToolTip="بحث"/>
                <Button Content="{StaticResource RefreshImage}" Margin="3" Command="{Binding RefreshCommand}"
                        ToolTip="تحديث"/>
            </ToolBar>
        </ToolBarTray>
        <Border Grid.Row="1" Margin="5" BorderBrush="Silver" BorderThickness="1">
            <Grid  >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" MinWidth="200" />
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static p:Resources.OutboxNo}" Margin="3,5,3,3" VerticalAlignment="Center" />
                <TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Static p:Resources.OutboxDate}" Margin="3,5,3,3" VerticalAlignment="Center" />
                <TextBlock Grid.Column="2" Text="{x:Static p:Resources.OutboxSubject}" Margin="3,5,3,3" VerticalAlignment="Center" />
                <TextBlock Grid.Row="1" Grid.Column="2" Text="{x:Static p:Resources.OutboxGoingTo}" VerticalAlignment="Center" Margin="3,5,3,3"  />
                <TextBox Grid.Column="1" MinHeight="30" Text="{Binding Path=OutboxNo, UpdateSourceTrigger=PropertyChanged}"  VerticalAlignment="Center" Margin="3" />
                <extended:MaskedTextBox Mask="## /##/ ####" Value="{Binding Path=OutboxDate, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource dateConverter}}" 
                                        IncludeLiterals="False" Grid.Column="1" Grid.Row="1" Margin="3,5,3,3" VerticalAlignment="Center" 
                                        MinHeight="30" />
                <TextBox Grid.Column="3" Text="{Binding Path=Subject, UpdateSourceTrigger=PropertyChanged}"  
                         VerticalAlignment="Center" Margin="3,5,3,3" MinHeight="30"/>
                <TextBox Grid.Column="3" Grid.Row="1" Text="{Binding Path=GoingTo, UpdateSourceTrigger=PropertyChanged}" 
                         VerticalAlignment="Center" Margin="3,5,3,3" MinHeight="30"/>
            </Grid>
        </Border>
        
        <DataGrid Grid.Row="2" AutoGenerateColumns="False" ItemsSource="{Binding Path=Outboxes}" CanUserAddRows="False" IsReadOnly="True" FontSize="18" Margin="5"
                   Style="{DynamicResource GridStyle}" IsSynchronizedWithCurrentItem="True">
            <DataGrid.Columns>
                <DataGridTextColumn Header="{x:Static p:Resources.OutboxNo}" Binding="{Binding Path=OutboxNo}"/>
                <DataGridTemplateColumn Header="{x:Static p:Resources.OutboxDate}" 
                                        CellTemplate="{StaticResource MaskedCellTemplate}"/>
                <DataGridTextColumn Header="{x:Static p:Resources.OutboxSubject}" Width="*" Binding="{Binding Path=Subject}"/>
                <DataGridTextColumn Header="{x:Static p:Resources.OutboxGoingTo}" Binding="{Binding Path=GoingTo}"/>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>

</UserControl>
